<?php 
error_reporting(0);
include('header.php');
include('menu.php');
include('config.php');
include_once('connection/connection.php');
$rain_district=$_REQUEST['DT'];
$rain_block=$_REQUEST['BC'];
function getName($colName,$id)
{
	$sqlgetName="select distinct ".$colName."_name from tbl_lookup_location where ".$colName."_id=".$id;
	$querygetName=mysql_query($sqlgetName);
	$rowgetName=mysql_fetch_row($querygetName);
	return $rowgetName[0];
}
$query_rainfall_main="select * from tbl_dtls_rainfall where district_id='$rain_district' and block_id='$rain_block'";
$result_rainfall_main=mysql_query($query_rainfall_main);
$row_rainfall_main=mysql_fetch_array($result_rainfall_main);

$query_rainfall_details="select * from tbl_dtls_rainfall_details where district_id='$rain_district' and block_id='$rain_block'";
$result_rainfall_details=mysql_query($query_rainfall_details);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>P&T</title>
<link href="css/style_question.css" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="js/validate.js"></script>
<script language="Javascript" type="text/javascript" src="water_rainfall_js.js"></script>
<script language="javascript" type="text/javascript">
function validate()
{
	valid = true;
	if (document.view_main_q1.district.selectedIndex == 0)
    {
        alert ( "Please select District Name" );
        valid = false;
    }
	if (document.view_main_q1.form_id.selectedIndex == 0)
    {
        alert ( "Please select Form Id" );
        valid = false;
    }
	return valid;
}	
</script>
<script type="text/javascript" src="js/jquery.js"></script>
<script language="javascript" src="js/cal2.js">
/*
Xin's Popup calendar script-  Xin Yang (http://www.yxscripts.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/
</script>
<script language="javascript" type="text/javascript">

function showID()
{
//Define calendar(s): addCalendar ("Unique Calendar Name", "Window title", "Form element's name", Form name")
var num=document.getElementById("numfield").value;
var i=0;
for (i=0;i<=num;i++)
{
addCalendar("Calendar" + i, "Select Date", "testing_date" + i, "view_main_q1");
}
// default settings for English
// Uncomment desired lines and modify its values
// setFont("verdana", 9);
 setWidth(90, 1, 15, 1);
// setColor("#cccccc", "#cccccc", "#ffffff", "#ffffff", "#333333", "#cccccc", "#333333");
// setFontColor("#333333", "#333333", "#333333", "#ffffff", "#333333");
// setFormat("yyyy/mm/dd");
// setSize(200, 200, -200, 16);

// setWeekDay(0);
// setMonthNames("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
// setDayNames("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
// setLinkNames("[Close]", "[Clear]");
}
</script>
<script language="javascript" type="text/javascript">
 function ucase(a)
       {
       var b=a.value;
       b=b.toUpperCase();
       a.value=b;
       }

</script>
<!-- face file start -->
<script src="facefiles/jquery-1.2.2.pack.js" type="text/javascript"></script>
<link href="facefiles/facebox.css" media="screen" rel="stylesheet" type="text/css" />
<script src="facefiles/facebox.js" type="text/javascript"></script>

<script type="text/javascript">
    jQuery(document).ready(function($) {
      $('a[rel*=facebox]').facebox() 
    })
	
</script>
<!-- end face file -->

</head>
<body>
<div align="center">
<form action="" method="post" enctype="multipart/form-data" onSubmit="return validate()" name="view_main_q1" id="view_main_q1">
<table border="0" width="746" id="table1" cellspacing="0" cellpadding="0" style="padding:10px;">
	<tr bgcolor="FF9966">
		<td height="29" colspan="5" align="left" valign="top" background="images/title.gif">&nbsp;</td>
	</tr>
	<tr>
	<td bgcolor="#E5E5E5" align="center" colspan="5" style="padding-top:5px">
	<span lang="en-us">&nbsp;</span><span lang="en-us" style="font-size: 8.5pt"><font face="Verdana" color="#006699"><b>Rainfall Data List</b></font></span></td>
</tr>
<tr><td bgcolor="#E5E5E5" align="left" colspan="5">&nbsp;</td>
</tr>
<tr>
  <td width="151" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b>District Name-</b></font></td>
  <td width="175" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b><?php echo getName('district',$row_rainfall_main['district_id']);?></b></font></td>
  <td width="122" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b>Block Name-</b></font></td>
  <td width="366" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b><?php echo getName('block',$row_rainfall_main['block_id']);?></b></font></td>
  <td width="128" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b><a href="edit_rainfall_mainBlock.php?id=<?php echo $row_rainfall_main['id'];?>" rel="facebox" style="text-decoration:none"> <img src="images/edit.png" height="12" width="12"> EDIT</a></b></font></td>
</tr>
		
		<tr>
			<td colspan="5"></td>
		</tr>
		<tr>
			<td colspan="5">
			<table width="743" border="0">
              
              <tr>
                <td width="155"></td>
                <td colspan="3"></td>
              </tr>
              <tr>
                <td bgcolor="#F0F0F0"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<b>Enter Station -</b></font></td>
                <td colspan="3" bgcolor="#F0F0F0"><font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo $row_rainfall_main['Station'];?></font></td>
              </tr>
              <tr bgcolor="#DDDDDD">
                <td><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<b>Station Latitude -</b></font></td>
                <td colspan="3"><font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo $row_rainfall_main['Station_Latitude'];?></font></td>
              </tr>
              <tr bgcolor="#F0F0F0">
                <td><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<b>Station Longitude -</b></font></td>
                <td colspan="3"><font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo $row_rainfall_main['Station_Longitude'];?></font></td>
              </tr>
              
              <tr bgcolor="#DDDDDD">
                <td><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<b>Year Range -</b></font></td>
                <td width="19"><font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo $row_rainfall_main['year_from'];?></font></td>
                <td width="3"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;To</font></td>
                <td width="478"><font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo $row_rainfall_main['year_to'];?></font></td>
              </tr>
              <tr>
                <td colspan="4" align="left" style="margin-top:10px;">
				<div style="background-color:#F9F9F9; border:1px solid #F2F2F2; padding:10px;" id="rain">
				<div style="padding:5px; font-family:Verdana; font-size:12px; color:#0099FF"><b>Rainfall details here </b></div>
				<table width="728" border="0">
  <tr>
    <td width="85">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b>Year</b></font></td>
    <td width="159">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b>Annual Rainfall(mm)</b></font></td>
    <td width="154">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b>Annual Rainydays(nos)</b></font></td>
    <td width="177">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b>Highest Rainfall(mm)</b></font></td>
    <td width="119">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b>On Date</b></font></td>
    <td width="119">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b>Edit</b></font></td>
    <td width="119">&nbsp;</td>
  </tr>


				<?php
				while($row_rainfall_details=mysql_fetch_array($result_rainfall_details))
				{
				?>
				 <tr>
    <td width="85">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo $row_rainfall_details['year'];?></font></td>
    <td width="159">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo $row_rainfall_details['Annual_Rainfall'];?></font></td>
    <td width="154">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo $row_rainfall_details['Annual_Rainydays'];?></font></td>
    <td width="177">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo $row_rainfall_details['Heighest_Rainfall'];?></font></td>
    <td width="119">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo $row_rainfall_details['On_Date'];?></font></td>
    <td width="119">&nbsp;<a href="edit_rainfall_detailBlock.php?subID=<?php echo $row_rainfall_details['id'];?>" rel="facebox" style="text-decoration:none"> <img src="images/edit.png" height="10" width="10"></a></td>
    <td width="119">&nbsp;</td>
				 </tr>
				<?php
				}
				?>
				</table>
				</div></td>
              </tr>
            </table>			</td>
		</tr>
		
		<tr>
			<td colspan="5">					</td>
		</tr>
	</table>
</form>
</div>
</body>
</html>
